<?php

use yii\db\Migration;

/**
 * Handles the creation of table `sign`.
 */
class m180908_084249_create_sign_table extends Migration
{
    public $tableName = '{{%sign}}';

    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->createTable('sign', [
            'id' => $this->primaryKey(),
            'number' => $this->string(255)->notNull()->comment('号码牌'),
            'name' => $this->string(255)->notNull()->comment('姓名'),
            'mobile' => $this->string(255)->notNull()->comment('手机号'),
            'sort' => $this->integer(11)->unsigned()->notNull()->comment('手机号'),
            'created_at' => $this->integer(11)->notNull()->unsigned()->comment('创建时间'),
        ]);

        $this->createIndex('idx-number', $this->tableName, 'number');
        $this->createIndex('idx-mobile', $this->tableName, 'mobile');
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable($this->tableName);
    }
}
